home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
linklist
/
source.lha
/
patch1
< prev
next >
Wrap
Text File
|
1993-08-08
|
50KB
|
2,152 lines
*** ../CHANGES Wed May 19 15:57:55 1993
--- CHANGES Wed May 19 15:39:41 1993
***************
*** 1,5 ****
! Most important changes from version 0.7 to version 0.8 :
- Routine lIndxNode is renamed to lGetIndxNode.
- Routine lFlagNode is renamed to lFndFlagNode.
--- 1,16 ----
! Most important changes from version 0.8 to version 0.9 (May 1993) :
+ - Bug solved in the heap sorting algorithm.
+
+ - Ported to Amiga by James Diffendaffer.
+
+ - Some additional porting solutions for Borland and other MSDOS C
+ compilers by Shane Brath).
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.7 to version 0.8 (March 1993) :
+
- Routine lIndxNode is renamed to lGetIndxNode.
- Routine lFlagNode is renamed to lFndFlagNode.
***************
*** 10,12 ****
--- 21,67 ----
lSort.
- Defines are made more specific; FIRST is renamed to lFIRST, etc.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.6 to version 0.7 (March 1992) :
+
+ - Ported to Macintosh by Vincent van Gentevoort.
+
+ - New routine 'lFlagNode'.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.5 to version 0.6 (December 1991) :
+
+ - Ported to VAX/VMS by Anita Eijs & Rene Balkenende.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.4 to version 0.5 (February 1991) :
+
+ - Return type for each routine.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.3 to version 0.4 (November 1990) :
+
+ - New routines 'lDump' and 'lUndump'.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.2 to version 0.3 (September 1990) :
+
+ - New routine 'lError'.
+
+ --------------------------------------------------------------------------------
+
+ Most important changes from version 0.1 to version 0.2 (April 1990) :
+
+ - New routine 'lIndxNode'.
+
+ --------------------------------------------------------------------------------
+
+ Version 0.1 (May 1989) :
+
+ - Created by Anita Eijs, TNO-BOUW, BouwInformatica.
*** ../README Mon May 3 12:58:56 1993
--- README Tue May 25 15:23:21 1993
***************
*** 2,8 ****
===================
! The distribution of the Generic Linked List package (Version 0.8, May 1993)
includes the following files:
Doc/Intro.3 - [nt]roff manual pages
--- 2,8 ----
===================
! The distribution of the Generic Linked List package (Version 0.9, May 1993)
includes the following files:
Doc/Intro.3 - [nt]roff manual pages
***************
*** 26,31 ****
--- 26,34 ----
Doc/lUpdNode.3
Makefile - Berkeley or System V Makefile
Makefile.BCC - Borland C++ v3.1 Makefile
+ ReadMe.BCC - some additional info about Borland port
+ Makefile.Amiga - Amiga SAS C 6.0 Makefile
+ ReadMe.Amiga - some additional info about Amiga port
README - this file !
CHANGES - list of changes
Tools_makerule - make rules for Makefile
***************
*** 43,51 ****
2) Check the environment settings (RANLIB) in the Tools_makerule.
! 3) Enter 'make newlib' at the UNIX prompt.
! 4) Enter 'make test' or 'make example' to create the executable of
the program 'example' at the UNIX prompt.
--- 46,56 ----
2) Check the environment settings (RANLIB) in the Tools_makerule.
! 3) Be sure that the LIB-directory is created.
! 4) Enter 'make newlib' at the UNIX prompt.
!
! 5) Enter 'make test' or 'make example' to create the executable of
the program 'example' at the UNIX prompt.
***************
*** 55,63 ****
The Generic Linked List is in the public domain. It is available at our FTP
! archive (ftp.tno.nl or hermes.bouw.tno.nl), just retrieve te files :
! /pub/TNO/BOUW/Bouwinf/linkedlist_0.8.README
! /pub/TNO/BOUW/Bouwinf/linkedlist_0.8.shar
If you have any comments, suggestions, or find any bugs, or make any changes
--- 60,68 ----
The Generic Linked List is in the public domain. It is available at our FTP
! archive (ftp.tno.nl or hermes.bouw.tno.nl), just retrieve the files :
! /pub/TNO/BOUW/Bouwinf/linkedlist_0.9.README
! /pub/TNO/BOUW/Bouwinf/linkedlist_0.9.shar
If you have any comments, suggestions, or find any bugs, or make any changes
***************
*** 69,72 ****
P.O. Box 49
2600 AA Delft
The Netherlands
! FAX : +31 15 843990
--- 74,77 ----
P.O. Box 49
2600 AA Delft
The Netherlands
! FAX : +31 15 122182
*** ../example.c Fri Feb 26 09:04:13 1993
--- example.c Fri May 21 09:58:14 1993
***************
*** 1,3 ****
--- 1,7 ----
+ #ifdef AMIGA
+ #include <string.h>
+ #endif
+
#include <stdio.h>
#include "list.h"
***************
*** 8,16 ****
} Rapport;
int rapSz = sizeof(Rapport);
static void insRap(), prRapAll(), prRap();
! static int search(), compare();
main()
{
int id, code, search_date;
--- 12,30 ----
} Rapport;
int rapSz = sizeof(Rapport);
+ #ifdef ANSI
+ static void insRap(int id, int where, int flag, char *title, char *author,
+ int date);
+ static void prRapAll(int id);
+ static void prRap(int code, Rapport *rpprt);
+ static int search(int *date, Rapport *rpprt);
+ static int compare(Rapport *data1, Rapport *data2);
+ #else
static void insRap(), prRapAll(), prRap();
! static int search(), compare();
! #endif
+ int
main()
{
int id, code, search_date;
***************
*** 82,89 ****
static void
insRap(id, where, flag, title, author, date)
! int id, where, flag, date;
! char *title, *author;
{
int code;
Rapport rap;
--- 96,103 ----
static void
insRap(id, where, flag, title, author, date)
! int id, where, flag, date;
! char *title, *author;
{
int code;
Rapport rap;
*** ../list.c Mon May 3 11:08:59 1993
--- list.c Wed May 19 16:38:34 1993
***************
*** 1,3 ****
--- 1,6 ----
+ #pragma option -ml -v -vi- -w-ret -w-nci -w-inl -wamp -w-par -w-cpt -w-dup -w-pia -w-ill -w-sus -wstv -w-ext -w-ias -w-ibc -w-pre -w-nst -A -G -O2 -w-sus -w-aus -w-par -w-pro -w-rvl
+ /* line at the top added for Borland or other MSDOS C compilers */
+
/*
** Anita Eijs TNO-BOUW, BouwInformatica May 1989
**
***************
*** 41,72 ****
** ***** Version 0.8, May 1993 *****
*/
! #ifdef MAC
! #define MAC_OR_VAXC
#endif
! #ifdef VAXC
! #define MAC_OR_VAXC
! #define MSDOS_OR_VAXC
#endif
#ifdef MSDOS
! #define MSDOS_OR_VAXC
#endif
#ifdef MAC
#include <unix.h> /* open, creat, write, read, close */
#include <stddef.h> /* sizeof */
#endif
! #ifdef MAC_OR_VAXC
#include <stdlib.h>
! #else
! #include <malloc.h>
#endif
- #ifdef MSDOS
- #include <io.h> /* open, creat, write, read, close */
- #endif
-
#include <stdio.h>
#include "list.h"
--- 44,84 ----
** ***** Version 0.8, May 1993 *****
*/
! #ifdef __MSDOS__
! #define MSDOS
! #define ANSI
#endif
!
! #ifdef UNIX
! #include <malloc.h>
#endif
+
#ifdef MSDOS
! #include <malloc.h>
! #include <io.h> /* open, creat, write, read, close */
! /* added for Borland or other MSDOS C compilers */
! #include <stdlib.h>
! #include <fcntl.h>
! #include <sys\types.h>
! #include <sys\stat.h>
! #include <string.h>
#endif
+ #ifdef VAXC
+ #include <stdlib.h>
+ #endif
+
#ifdef MAC
#include <unix.h> /* open, creat, write, read, close */
#include <stddef.h> /* sizeof */
+ #include <stdlib.h>
#endif
! #ifdef AMIGA
#include <stdlib.h>
! #include <fcntl.h> /* open, creat, write, read, close */
#endif
#include <stdio.h>
#include "list.h"
***************
*** 98,106 ****
while (i--) *to++ = *frm++; \
}
! #define BIN_WRITE 1 /* necessary for binary file access */
#define BIN_READ 0
#define PMODE 0666
/* -------------------------------------------------------------------------- */
--- 110,125 ----
while (i--) *to++ = *frm++; \
}
! /* necessary for binary file access */
! #ifdef MSDOS
! #define BIN_WRITE O_WRONLY|O_BINARY
! #define BIN_READ O_RDONLY|O_BINARY
! #define PMODE S_IREAD
! #else
! #define BIN_WRITE 1
#define BIN_READ 0
#define PMODE 0666
+ #endif
/* -------------------------------------------------------------------------- */
***************
*** 148,154 ****
static void lError(char *str, int code, int int1, int int2, char *str1);
static int setWhchNode(int id, int which, char *fname);
static int setIndxNode(int id, int index, char *fname);
! static int partition(NodePtr *array, int order, Func func, int lb, int ub,
int *pj);
static int stack_empty(int id);
static int intInSet(int intgr, int *set, int set_n);
--- 167,173 ----
static void lError(char *str, int code, int int1, int int2, char *str1);
static int setWhchNode(int id, int which, char *fname);
static int setIndxNode(int id, int index, char *fname);
! static void partition(NodePtr *array, int order, Func func, int lb, int ub,
int *pj);
static int stack_empty(int id);
static int intInSet(int intgr, int *set, int set_n);
***************
*** 159,165 ****
static void lError();
static int setWhchNode();
static int setIndxNode();
! static int partition();
static int stack_empty();
static int intInSet();
#endif
--- 178,184 ----
static void lError();
static int setWhchNode();
static int setIndxNode();
! static void partition();
static int stack_empty();
static int intInSet();
#endif
***************
*** 186,199 ****
** Return on error:
** lWRONG_SD, lWRONG_CC
*/
- #ifdef ANSI
int
- lDef(int sd, int cc)
- #else
- int
lDef(sd, cc)
int sd, cc;
- #endif
{
ListPtr list, new;
static int set1[] = { lSINGLY, lDOUBLY },
--- 205,213 ----
***************
*** 245,258 ****
** Return on error:
** lUNKNOWN_ID
*/
- #ifdef ANSI
int
- lInfo(int id, int *sd, int *cc, int *n)
- #else
- int
lInfo(id, sd, cc, n)
int id, *sd, *cc, *n;
- #endif
{
ListPtr list;
--- 259,267 ----
***************
*** 286,299 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_ORDER, lWRONG_THEORY
*/
- #ifdef ANSI
- int lSort(int id, int order, int theory, Func func)
- #else
int
lSort(id, order, theory, func)
int id, order, theory;
Func func;
- #endif
{
int node_n, i, s, f, k, where, j, cmp;
ListPtr list;
--- 295,304 ----
***************
*** 320,331 ****
return(lWRONG_THEORY);
}
node_n = list->n;
! /* allocate 1 extra so I can nave a null in it */
CALLOC(array, NodePtr, node_n+1);
list->current = list->first;
! for (i=0; i<node_n && list->current != NULL ; i++) {
array[i] = list->current;
list->current = (list->current)->nxt;
}
--- 325,340 ----
return(lWRONG_THEORY);
}
+ /* one node is already sorted */
+ if (list->n == 1)
+ return(lSUCCESS);
+
node_n = list->n;
! /* allocate 1 extra so I can have a null in it */
CALLOC(array, NodePtr, node_n+1);
list->current = list->first;
! for (i=0; i < node_n && list->current != NULL; i++) {
array[i] = list->current;
list->current = (list->current)->nxt;
}
***************
*** 377,386 ****
s = -1;
else
s = 1;
! cmp = (*func)(array[2]->data, array[1]->data);
! if (i > 2 && ((order == lASCENDING && cmp == l2LT1)
! || (order == lDESCENDING && cmp == l1LT2)))
! s = 2;
if (s >= 0)
cmp = (*func)(temp->data, array[s]->data);
--- 386,397 ----
s = -1;
else
s = 1;
! if (i > 2) {
! cmp = (*func)(array[2]->data, array[1]->data);
! if ((order == lASCENDING && cmp == l2LT1)
! || (order == lDESCENDING && cmp == l1LT2))
! s = 2;
! }
if (s >= 0)
cmp = (*func)(temp->data, array[s]->data);
***************
*** 393,399 ****
if (s+1 <= i-1) {
cmp = (*func)(array[s]->data,
array[s+1]->data);
! if (cmp < 0)
s = s+1;
}
if (s > i-1)
--- 404,413 ----
if (s+1 <= i-1) {
cmp = (*func)(array[s]->data,
array[s+1]->data);
! if ((order == lASCENDING
! && cmp == l1LT2) ||
! (order == lDESCENDING
! && cmp == l2LT1))
s = s+1;
}
if (s > i-1)
***************
*** 474,480 ****
case lSELECTION: {
int indx;
! for (i=node_n-1; i>0 ; i--) {
temp = array[0];
indx = 0;
--- 488,494 ----
case lSELECTION: {
int indx;
! for (i=node_n-1; i>0; i--) {
temp = array[0];
indx = 0;
***************
*** 557,571 ****
** header.n number of <info>-<data>-combinations (nodes)
** info.size size of <data>
*/
- #ifdef ANSI
int
- lDump(int id, char *file)
- #else
- int
lDump(id, file)
int id;
char *file;
- #endif
{
#ifndef MSDOS
int open(), creat(), write(), close();
--- 571,580 ----
***************
*** 622,639 ****
** Return on error:
** lOPEN_ERROR
*/
- #ifdef ANSI
int
- lUndump(char *file)
- #else
- int
lUndump(file)
char *file;
- #endif
{
#ifndef MSDOS
int open(), read(), close();
#endif
int fdDump, i, id;
Info info;
--- 631,645 ----
** Return on error:
** lOPEN_ERROR
*/
int
lUndump(file)
char *file;
{
#ifndef MSDOS
+ #ifndef AMIGA
int open(), read(), close();
#endif
+ #endif
int fdDump, i, id;
Info info;
***************
*** 674,687 ****
** Return on error:
** lUNKNOWN_ID
*/
- #ifdef ANSI
int
- lDel(int id)
- #else
- int
lDel(id)
int id;
- #endif
{
ListPtr list;
--- 680,688 ----
***************
*** 710,722 ****
** Return on error:
** lNO_LIST
*/
- #ifdef ANSI
int
- lDelAll(void)
- #else
- int
lDelAll()
- #endif
{
ListPtr list, nxt;
--- 711,718 ----
***************
*** 760,774 ****
** Return on error:
** lUNKNOWN_ID, lWRONG_WHERE
*/
- #ifdef ANSI
int
- lInsNode(int id, int where, Byte *data, int size, int flag)
- #else
- int
lInsNode(id, where, data, size, flag)
int id, where, size, flag;
Byte *data;
- #endif
{
ListPtr list;
NodePtr node, new;
--- 756,765 ----
***************
*** 892,905 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY
*/
- #ifdef ANSI
int
- lInfoNode(int id, int which, int *size, int *flag)
- #else
- int
lInfoNode(id, which, size, flag)
int id, which, *size, *flag;
- #endif
{
ListPtr list;
int rtrn;
--- 883,891 ----
***************
*** 932,946 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY, lSIZE_NE
*/
- #ifdef ANSI
int
- lGetNode(int id, int which, Byte *data, int size)
- #else
- int
lGetNode(id, which, data, size)
int id, which, size;
Byte *data;
- #endif
{
ListPtr list;
int rtrn;
--- 918,927 ----
***************
*** 959,965 ****
BYTE_COPY((list->current)->data, data, size);
! if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
--- 940,953 ----
BYTE_COPY((list->current)->data, data, size);
! if (list->n == 1) {
! if (which == lPREVIOUS || which == lLAST)
! return(lFIRST);
! else if (which == lNEXT || which == lFIRST)
! return(lLAST);
! else
! return(lLAST); /* which == lCURRENT */
! } else if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
***************
*** 972,978 ****
**
** Parameters:
** In int id identifier of linked list
! ** In int where from where must be searched
** In Func func function for checking the data on conditions
** In Byte *ptr data for comparison in function
** Out Byte *data data of node
--- 960,967 ----
**
** Parameters:
** In int id identifier of linked list
! ** In int which from which node must be searched and in which
! ** direction
** In Func func function for checking the data on conditions
** In Byte *ptr data for comparison in function
** Out Byte *data data of node
***************
*** 981,998 ****
** Return on success:
** lFOUND, lFIRST, lLAST, lNOT_FOUND
** Return on error:
! ** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHERE, lUNKNOWN_FUNC, lNOT_DOUBLY
*/
- #ifdef ANSI
int
! lFndNode(int id, int where, Func func, Byte *ptr, Byte *data, int size)
! #else
! int
! lFndNode(id, where, func, ptr, data, size)
! int id, where, size;
Func func;
Byte *ptr, *data;
- #endif
{
NodePtr node;
ListPtr list;
--- 970,982 ----
** Return on success:
** lFOUND, lFIRST, lLAST, lNOT_FOUND
** Return on error:
! ** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lUNKNOWN_FUNC, lNOT_DOUBLY
*/
int
! lFndNode(id, which, func, ptr, data, size)
! int id, which, size;
Func func;
Byte *ptr, *data;
{
NodePtr node;
ListPtr list;
***************
*** 1008,1016 ****
lError("lFndNode", lEMPTY_LIST, id, 0, NULL);
return(lEMPTY_LIST);
}
! if (intInSet(where, set, 4) != 0) {
! lError("lFndNode", lWRONG_WHERE, where, 0, NULL);
! return(lWRONG_WHERE);
}
if (func == NULL) {
lError("lFndNode", lUNKNOWN_FUNC, (int) func, 0, NULL);
--- 992,1000 ----
lError("lFndNode", lEMPTY_LIST, id, 0, NULL);
return(lEMPTY_LIST);
}
! if (intInSet(which, set, 4) != 0) {
! lError("lFndNode", lWRONG_WHICH, which, 0, NULL);
! return(lWRONG_WHICH);
}
if (func == NULL) {
lError("lFndNode", lUNKNOWN_FUNC, (int) func, 0, NULL);
***************
*** 1017,1024 ****
return(lUNKNOWN_FUNC);
}
! /* set node for where searching must start */
! switch (where) {
case lFIRST: node = list->first; break;
case lNEXT:
case lPREVIOUS: node = list->current; break;
--- 1001,1008 ----
return(lUNKNOWN_FUNC);
}
! /* set node where searching must start */
! switch (which) {
case lFIRST: node = list->first; break;
case lNEXT:
case lPREVIOUS: node = list->current; break;
***************
*** 1026,1037 ****
}
/* expected data and node must have same size */
! if ((where == lFIRST || where == lLAST) && node->size == size) {
BYTE_COPY(node->data, data, size);
cmp = (*func)(ptr, data);
}
! switch (where) {
case lFIRST: /* search forward */
case lNEXT:
while (cmp != lFOUND && node->nxt != NULL
--- 1010,1021 ----
}
/* expected data and node must have same size */
! if ((which == lFIRST || which == lLAST) && node->size == size) {
BYTE_COPY(node->data, data, size);
cmp = (*func)(ptr, data);
}
! switch (which) {
case lFIRST: /* search forward */
case lNEXT:
while (cmp != lFOUND && node->nxt != NULL
***************
*** 1080,1085 ****
--- 1064,1071 ----
**
** Parameters:
** In int id identifier of linked list
+ ** In int which from which node must be searched and in which
+ ** direction
** In int flag flag of node which must be retrieved
** Out Byte *data data of node
** In int size size of data
***************
*** 1087,1103 ****
** Return on success:
** lFOUND, lFIRST, lLAST, lNOT_FOUND
** Return on error:
! ** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHERE, lSIZE_NE
*/
- #ifdef ANSI
int
! lFndFlagNode(int id, int where, int flag, Byte *data, int size)
! #else
! int
! lFndFlagNode(id, where, flag, data, size)
! int id, where, flag, size;
Byte *data;
- #endif
{
NodePtr node;
ListPtr list;
--- 1073,1084 ----
** Return on success:
** lFOUND, lFIRST, lLAST, lNOT_FOUND
** Return on error:
! ** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lSIZE_NE
*/
int
! lFndFlagNode(id, which, flag, data, size)
! int id, which, flag, size;
Byte *data;
{
NodePtr node;
ListPtr list;
***************
*** 1112,1124 ****
lError("lFndFlagNode", lEMPTY_LIST, id, 0, NULL);
return(lEMPTY_LIST);
}
! if (intInSet(where, set, 4) != 0) {
! lError("lFndFlagNode", lWRONG_WHERE, where, 0, NULL);
! return(lWRONG_WHERE);
}
! /* set node for where searching must start */
! switch (where) {
case lFIRST:
node = list->first;
break;
--- 1093,1105 ----
lError("lFndFlagNode", lEMPTY_LIST, id, 0, NULL);
return(lEMPTY_LIST);
}
! if (intInSet(which, set, 4) != 0) {
! lError("lFndFlagNode", lWRONG_WHICH, which, 0, NULL);
! return(lWRONG_WHICH);
}
! /* set node where searching must start */
! switch (which) {
case lFIRST:
node = list->first;
break;
***************
*** 1138,1144 ****
}
/* search till begin/end of list */
! switch (where) {
case lFIRST: /* search forward */
case lNEXT:
while (node->flag != flag && node != list->last)
--- 1119,1125 ----
}
/* search till begin/end of list */
! switch (which) {
case lFIRST: /* search forward */
case lNEXT:
while (node->flag != flag && node != list->last)
***************
*** 1172,1178 ****
BYTE_COPY((list->current)->data, data, size);
! if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
--- 1153,1166 ----
BYTE_COPY((list->current)->data, data, size);
! if (list->n == 1) {
! if (which == lPREVIOUS || which == lLAST)
! return(lFIRST);
! else if (which == lNEXT || which == lFIRST)
! return(lLAST);
! else
! return(lLAST); /* which == lCURRENT */
! } else if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
***************
*** 1181,1187 ****
}
/*******************************************************************************
! ** Update curent node.
**
** Parameters:
** In int id identifier of linked list
--- 1169,1175 ----
}
/*******************************************************************************
! ** Update current node.
**
** Parameters:
** In int id identifier of linked list
***************
*** 1194,1208 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST
*/
- #ifdef ANSI
int
- lUpdNode(int id, Byte *data, int size, int flag)
- #else
- int
lUpdNode(id, data, size, flag)
int id, size, flag;
Byte *data;
- #endif
{
ListPtr list;
--- 1182,1191 ----
***************
*** 1242,1255 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH
*/
- #ifdef ANSI
int
- lDelNode(int id, int which)
- #else
- int
lDelNode(id, which)
int id, which;
- #endif
{
NodePtr node, prv, nxt;
ListPtr list;
--- 1225,1233 ----
***************
*** 1355,1368 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
*/
- #ifdef ANSI
int
- lInfoIndxNode(int id, int index, int *size, int *flag)
- #else
- int
lInfoIndxNode(id, index, size, flag)
int id, index, *size, *flag;
- #endif
{
ListPtr list;
int rtrn;
--- 1333,1341 ----
***************
*** 1394,1408 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX, lSIZE_NE
*/
- #ifdef ANSI
int
- lGetIndxNode(int id, int index, Byte *data, int size)
- #else
- int
lGetIndxNode(id, index, data, size)
int id, index, size;
Byte *data;
- #endif
{
ListPtr list;
int rtrn;
--- 1367,1376 ----
***************
*** 1422,1428 ****
BYTE_COPY((list->current)->data, data, size);
! if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
--- 1390,1398 ----
BYTE_COPY((list->current)->data, data, size);
! if (list->n == 1)
! return(lLAST);
! else if (list->current == list->first)
return(lFIRST);
else if (list->current == list->last)
return(lLAST);
***************
*** 1445,1459 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
*/
- #ifdef ANSI
int
- lUpdIndxNode(int id, int index, Byte *data, int size, int flag)
- #else
- int
lUpdIndxNode(id, index, data, size, flag)
int id, index, size, flag;
Byte *data;
- #endif
{
ListPtr list;
int rtrn;
--- 1415,1424 ----
***************
*** 1489,1502 ****
** Return on error:
** lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
*/
- #ifdef ANSI
int
- lDelIndxNode(int id, int index)
- #else
- int
lDelIndxNode(id, index)
int id, index;
- #endif
{
int rtrn;
--- 1454,1462 ----
***************
*** 1510,1523 ****
/* ---------- static local functions ---------------------------------------- */
/* get address of list data */
- #ifdef ANSI
static ListPtr
- getAddress(int id)
- #else
- static ListPtr
getAddress(id)
int id;
- #endif
{
ListPtr list;
--- 1470,1478 ----
***************
*** 1535,1549 ****
}
/* delete nodes of a linked list */
- #ifdef ANSI
static void
- delNodes(NodePtr node, int n)
- #else
- static void
delNodes(node, n)
NodePtr node;
int n;
- #endif
{
NodePtr nxt;
int i;
--- 1490,1499 ----
***************
*** 1557,1570 ****
}
/* delete info about linked list */
- #ifdef ANSI
static void
- delListInfo(ListPtr list)
- #else
- static void
delListInfo(list)
ListPtr list;
- #endif
{
ListPtr nxt;
--- 1507,1515 ----
***************
*** 1576,1592 ****
}
/* print error message in lERROR_FILE */
- #ifdef ANSI
static void
- lError(char *str, int code, int int1, int int2, char *str1)
- #else
- static void
lError(str, code, int1, int2, str1)
char *str, *str1;
int code, int1, int2;
- #endif
{
- #ifndef MSDOS
char mess[60];
FILE *fpError, *fopen();
--- 1521,1531 ----
***************
*** 1660,1680 ****
fprintf(stderr, "Can't open error-file '%s'\n", lERROR_FILE);
fprintf(stderr, "Error, '%s': %s\n", str, mess);
} else {
! fprintf(fpError, "Error, '%s': %s\n", str, mess);
fclose(fpError);
}
- #endif
}
- #ifdef ANSI
static int
- setWhchNode(int id, int which, char *fname)
- #else
- static int
setWhchNode(id, which, fname)
int id, which;
char *fname;
- #endif
{
ListPtr list;
static int set[] = { lFIRST, lNEXT, lCURRENT, lPREVIOUS, lLAST };
--- 1599,1613 ----
fprintf(stderr, "Can't open error-file '%s'\n", lERROR_FILE);
fprintf(stderr, "Error, '%s': %s\n", str, mess);
} else {
! fprintf(fpError, "Error in '%s': %s\n", str, mess);
fclose(fpError);
}
}
static int
setWhchNode(id, which, fname)
int id, which;
char *fname;
{
ListPtr list;
static int set[] = { lFIRST, lNEXT, lCURRENT, lPREVIOUS, lLAST };
***************
*** 1726,1740 ****
return(lSUCCESS);
}
- #ifdef ANSI
static int
- setIndxNode(int id, int index, char *fname)
- #else
- static int
setIndxNode(id, index, fname)
int id, index;
char *fname;
- #endif
{
ListPtr list;
int i;
--- 1659,1668 ----
***************
*** 1767,1782 ****
}
/* local function for QUICK sort */
! #ifdef ANSI
! static int
! partition(NodePtr *array, int order, Func func, int lb, int ub, int *pj)
! #else
! static int
partition(array, order, func, lb, ub, pj)
NodePtr *array;
int order, lb, ub, *pj;
Func func;
- #endif
{
int down, up, cmp;
NodePtr temp, a;
--- 1695,1705 ----
}
/* local function for QUICK sort */
! static void
partition(array, order, func, lb, ub, pj)
NodePtr *array;
int order, lb, ub, *pj;
Func func;
{
int down, up, cmp;
NodePtr temp, a;
***************
*** 1812,1825 ****
}
/* local function for QUICK sort */
- #ifdef ANSI
static int
- stack_empty(int id)
- #else
- static int
stack_empty(id)
int id;
- #endif
{
int sd, cc, n;
--- 1735,1743 ----
*** ../list.h Tue Apr 20 11:06:14 1993
--- list.h Wed May 19 10:08:47 1993
***************
*** 50,59 ****
#define lFOUND 0 /* node found */
! #ifdef MSDOS_OR_VAXC
#define lERROR_FILE "linklist.err"
#else
#define lERROR_FILE "=listError="
#endif
#ifdef ANSI
--- 50,63 ----
#define lFOUND 0 /* node found */
! #ifdef MSDOS
#define lERROR_FILE "linklist.err"
#else
+ # ifdef VAXC
+ #define lERROR_FILE "linklist.err"
+ # else
#define lERROR_FILE "=listError="
+ # endif
#endif
#ifdef ANSI
*** ../sorted.c Fri Feb 26 11:25:09 1993
--- sorted.c Wed May 19 14:09:36 1993
***************
*** 2,10 ****
#include <string.h>
#include "list.h"
- static void addPersonSorted(), addPerson();
- static int fndNxtPerson(), sortPerson(), compare();
-
typedef struct person {
char lastname[15];
char firstname[15];
--- 2,7 ----
***************
*** 11,16 ****
--- 8,25 ----
} Person, *PersonPtr;
int personSz = sizeof(Person);
+ #ifdef ANSI
+ static void addPerson(int id, char *first, char *last);
+ static void addPersonSorted(int id, char *first, char *last);
+ static int compare(PersonPtr p1, PersonPtr p2, int order);
+ static int fndNxtPerson(char *last, PersonPtr data);
+ static int sortPerson(int id);
+ #else
+ static void addPerson(), addPersonSorted();
+ static int compare(), fndNxtPerson(), sortPerson();
+ #endif
+
+ int
main()
{
Person person;
*** ../sorttest.c Mon May 3 11:45:21 1993
--- sorttest.c Wed May 19 14:37:07 1993
***************
*** 1,9 ****
/* Sort torture test */
#include <stdio.h>
#include <string.h>
#include "list.h"
- #include "time.h"
typedef struct catalog {
char number[35];
--- 1,21 ----
/* Sort torture test */
+ #ifdef UNIX
+ #include <malloc.h>
+ #endif
+
+ #ifdef AMIGA
+ #include <stdlib.h>
+ #endif
+
+ #ifdef MSDOS
+ #include <malloc.h>
+ #endif
+
#include <stdio.h>
#include <string.h>
+ #include <time.h>
#include "list.h"
typedef struct catalog {
char number[35];
***************
*** 12,32 ****
int date;
} catalog;
static int compare_author();
static int compare_title();
static void load_it();
static void print_some();
static time_t what_time();
static void prRap();
- #ifdef ANSI
static int
- compare_author(catalog *a, catalog *b)
- #else
- static int
compare_author(a, b)
catalog *a, *b;
- #endif
{
int k;
--- 24,50 ----
int date;
} catalog;
+ #ifdef ANSI
+ static int compare_author(catalog *a, catalog *b);
+ static int compare_title(catalog *a, catalog *b, int order);
+ static void load_it(int id, int num);
+ static void print_some(int id, int num);
+ static time_t what_time(void);
+ static void diff_time(time_t a, time_t b);
+ static void prRap(int code, catalog *rpprt);
+ #else
static int compare_author();
static int compare_title();
static void load_it();
static void print_some();
static time_t what_time();
+ static void diff_time();
static void prRap();
+ #endif
static int
compare_author(a, b)
catalog *a, *b;
{
int k;
***************
*** 40,54 ****
return(l1LT2);
}
- #ifdef ANSI
static int
- compare_title(catalog *a, catalog *b, int order)
- #else
- static int
compare_title(a, b, order)
catalog *a, *b;
int order;
- #endif
{
int k;
--- 58,67 ----
***************
*** 62,76 ****
return(l1LT2);
}
- #ifdef ANSI
static void
- load_it(int id, int num)
- #else
- static void
load_it(id, num)
int id;
int num;
- #endif
{
int loop, size = sizeof(catalog), code;
char c1, c2, c3, c4, c5, c6, c7, c8;
--- 75,84 ----
***************
*** 99,113 ****
/* printf("Linked List created\n"); */
}
- #ifdef ANSI
static void
- print_some(int id, int num)
- #else
- static void
print_some(id, num)
int id;
int num;
- #endif
{
int size = sizeof(catalog), loop;
int code;
--- 107,116 ----
***************
*** 122,142 ****
}
}
! #ifdef ANSI
! static time_t what_time(void)
! #else
! static time_t what_time()
! #endif
{
return((time_t)time(NULL));
}
! #ifdef ANSI
! static void diff_time(time_t a, time_t b)
! #else
! static void diff_time(a, b)
time_t a, b;
- #endif
{
struct tm *tt;
char buf1[101], buf2[101];
--- 125,139 ----
}
}
! static time_t
! what_time()
{
return((time_t)time(NULL));
}
! static void
! diff_time(a, b)
time_t a, b;
{
struct tm *tt;
char buf1[101], buf2[101];
***************
*** 160,165 ****
--- 157,163 ----
(sec[1] - sec[0] > 0)?(sec[1] - sec[0]) : (sec[0] - sec[1]));
}
+ int
main()
{
int size = sizeof(catalog);
***************
*** 175,181 ****
printf("Untouched list\n");
print_some(id, 10);
! printf("-- lQuickSort --\nlQuickSort DESCENDING by TITLE : ");
start = what_time();
code = lSort(id, lDESCENDING, lQUICK, compare_title);
finish = what_time();
--- 173,179 ----
printf("Untouched list\n");
print_some(id, 10);
! printf("lQuickSort DESCENDING by TITLE : ");
start = what_time();
code = lSort(id, lDESCENDING, lQUICK, compare_title);
finish = what_time();
***************
*** 213,219 ****
printf("Untouched list\n");
print_some(id, 10);
! printf(" -- lHeapSort -- \nlHeapSort DESCENDING by TITLE : ");
start = what_time();
code = lSort(id, lDESCENDING, lHEAP, compare_title);
finish = what_time();
--- 211,217 ----
printf("Untouched list\n");
print_some(id, 10);
! printf("lHeapSort DESCENDING by TITLE : ");
start = what_time();
code = lSort(id, lDESCENDING, lHEAP, compare_title);
finish = what_time();
***************
*** 332,343 ****
static void
prRap(code, rpprt)
! int code;
! catalog *rpprt;
{
if (code >= 0)
! printf("catalog :'%s' '%s' '%s' '%d'\n", rpprt->number, rpprt->title,
! rpprt->author, rpprt->date);
else
printf("Return code = %d\n", code);
}
--- 330,341 ----
static void
prRap(code, rpprt)
! int code;
! catalog *rpprt;
{
if (code >= 0)
! printf("catalog :'%s'\t'%s'\t'%s'\t'%d'\n", rpprt->number,
! rpprt->title, rpprt->author, rpprt->date);
else
printf("Return code = %d\n", code);
}
*** ../Doc/Intro.3 Fri Feb 26 10:56:12 1993
--- Doc/Intro.3 Thu May 27 12:01:52 1993
***************
*** 1,4 ****
- '.so tmac.clman
.TH "Intro"
.IX Intro
.SH NAME
--- 1,3 ----
***************
*** 78,83 ****
--- 77,86 ----
.SH EXAMPLE
.if t .ta 0.3i 0.6i 0.9i 1.2i 2.2i 3.2i 4.2i 4.5i 4.8i
.nf
+ #ifdef AMIGA
+ #include <string.h>
+ #endif
+
#include <stdio.h>
#include "list.h"
***************
*** 88,96 ****
} Rapport;
int rapSz = sizeof(Rapport);
static void insRap(), prRapAll(), prRap();
! static int search(), compare();
main()
{
int id, code, search_date;
--- 91,109 ----
} Rapport;
int rapSz = sizeof(Rapport);
+ #ifdef ANSI
+ static void insRap(int id, int where, int flag, char *title, char *author,
+ int date);
+ static void prRapAll(int id);
+ static void prRap(int code, Rapport *rpprt);
+ static int search(int *date, Rapport *rpprt);
+ static int compare(Rapport *data1, Rapport *data2);
+ #else
static void insRap(), prRapAll(), prRap();
! static int search(), compare();
! #endif
+ int
main()
{
int id, code, search_date;
***************
*** 102,111 ****
insRap(id, lFIRST, 2, "Book 2", "More People", 890130);
insRap(id, lLAST, 1, "Book 3", "Lots of People", 890131);
! fprintf(stdout, "lGetNode\n");
prRapAll(id);
! fprintf(stdout, "lGetIndxNode\n");
code = lGetIndxNode(id, 4, &rap, rapSz);
prRap(code, &rap);
code = lGetIndxNode(id, 2, &rap, rapSz);
--- 115,124 ----
insRap(id, lFIRST, 2, "Book 2", "More People", 890130);
insRap(id, lLAST, 1, "Book 3", "Lots of People", 890131);
! fprintf(stdout, "lGetNode\\n");
prRapAll(id);
! fprintf(stdout, "lGetIndxNode\\n");
code = lGetIndxNode(id, 4, &rap, rapSz);
prRap(code, &rap);
code = lGetIndxNode(id, 2, &rap, rapSz);
***************
*** 115,121 ****
code = lGetIndxNode(id, 3, &rap, rapSz);
prRap(code, &rap);
! fprintf(stdout, "lFndNode\n");
search_date = 890129;
code = lFndNode(id, lFIRST, search, &search_date, &rap, rapSz);
prRap(code, &rap);
--- 128,134 ----
code = lGetIndxNode(id, 3, &rap, rapSz);
prRap(code, &rap);
! fprintf(stdout, "lFndNode\\n");
search_date = 890129;
code = lFndNode(id, lFIRST, search, &search_date, &rap, rapSz);
prRap(code, &rap);
***************
*** 125,142 ****
prRap(code, &rap);
code = lDump(id, "dump");
! fprintf(stdout, "lDump : %d\n", code);
lDel(id);
id = lUndump("dump");
! fprintf(stdout, "lUndump : %d\n", id);
insRap(id, lFIRST, 4, "Book 4", "The Author", 891127);
prRapAll(id);
! fprintf(stdout, "lFndFlagNode\n");
code = lFndFlagNode(id, lFIRST, 1, &rap, rapSz);
prRap(code, &rap);
code = lFndFlagNode(id, lNEXT, 1, &rap, rapSz);
--- 138,155 ----
prRap(code, &rap);
code = lDump(id, "dump");
! fprintf(stdout, "lDump : %d\\n", code);
lDel(id);
id = lUndump("dump");
! fprintf(stdout, "lUndump : %d\\n", id);
insRap(id, lFIRST, 4, "Book 4", "The Author", 891127);
prRapAll(id);
! fprintf(stdout, "lFndFlagNode\\n");
code = lFndFlagNode(id, lFIRST, 1, &rap, rapSz);
prRap(code, &rap);
code = lFndFlagNode(id, lNEXT, 1, &rap, rapSz);
***************
*** 146,159 ****
code = lFndFlagNode(id, lFIRST, 7, &rap, rapSz);
prRap(code, &rap);
! fprintf(stdout, "Untouched list\n");
prRapAll(id);
! fprintf(stdout, "lSort\n");
lSort(id, lDESCENDING, lBUBBLE, compare);
prRapAll(id);
! fprintf(stdout, "lSort\n");
lSort(id, lASCENDING, lHEAP, compare);
prRapAll(id);
--- 159,172 ----
code = lFndFlagNode(id, lFIRST, 7, &rap, rapSz);
prRap(code, &rap);
! fprintf(stdout, "Untouched list\\n");
prRapAll(id);
! fprintf(stdout, "lSort\\n");
lSort(id, lDESCENDING, lBUBBLE, compare);
prRapAll(id);
! fprintf(stdout, "lSort\\n");
lSort(id, lASCENDING, lHEAP, compare);
prRapAll(id);
***************
*** 162,169 ****
static void
insRap(id, where, flag, title, author, date)
! int id, where, flag, date;
! char *title, *author;
{
int code;
Rapport rap;
--- 175,182 ----
static void
insRap(id, where, flag, title, author, date)
! int id, where, flag, date;
! char *title, *author;
{
int code;
Rapport rap;
***************
*** 195,204 ****
Rapport *rpprt;
{
if (code >= 0)
! fprintf(stdout, "Rapport : '%s' '%s' '%d'\n", rpprt->title,
rpprt->author, rpprt->date);
else
! fprintf(stdout, "Return code = %d\n", code);
}
static int
--- 208,217 ----
Rapport *rpprt;
{
if (code >= 0)
! fprintf(stdout, "Rapport : '%s' '%s' '%d'\\n", rpprt->title,
rpprt->author, rpprt->date);
else
! fprintf(stdout, "Return code = %d\\n", code);
}
static int
***************
*** 226,281 ****
return(l1LT2); /* key1 < key2 */
}
.fi
- .sp 2
- This example program produces the following output :
- .nf
- lGetNode
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Return code = -9
- lGetIndxNode
- Return code = -13
- Rapport : 'Book 1' 'People' '890129'
- Return code = -13
- Rapport : 'Book 3' 'Lots of People' '890131'
- lFndNode
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Return code = -10
- lDump : 0
- lUndump : 1
- Rapport : 'Book 4' 'The Author' '891127'
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Return code = -9
- lFndFlagNode
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Rapport : 'Book 2' 'More People' '890130'
- Return code = -10
- Untouched list
- Rapport : 'Book 4' 'The Author' '891127'
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Return code = -9
- lSort
- Rapport : 'Book 4' 'The Author' '891127'
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 3' 'Lots of People' '890131'
- Return code = -9
- lSort
- Rapport : 'Book 3' 'Lots of People' '890131'
- Rapport : 'Book 2' 'More People' '890130'
- Rapport : 'Book 1' 'People' '890129'
- Rapport : 'Book 4' 'The Author' '891127'
- Return code = -9
- .fi
.SH VERSION
! Generic Linked List 0.8, March 1993.
.SH PUBLIC DOMAIN
The Generic Linked List package is in the public domain. If you have
any comments, suggestions, or find any bugs, or make any changes you'd
--- 239,246 ----
return(l1LT2); /* key1 < key2 */
}
.fi
.SH VERSION
! Generic Linked List 0.9, May 1993.
.SH PUBLIC DOMAIN
The Generic Linked List package is in the public domain. If you have
any comments, suggestions, or find any bugs, or make any changes you'd
*** ../Doc/lDef.3 Fri Feb 26 10:30:43 1993
--- Doc/lDef.3 Thu May 27 12:01:53 1993
***************
*** 27,32 ****
--- 27,33 ----
lDOUBLY doubly linked list, each node points to the previous and
the next node
.fi
+ .sp 1
\fIcc\fP :
.nf
lCHAIN chain linked list, last node has a NULL-pointer
*** ../Doc/lFndFlagNode.3 Fri Feb 26 10:38:09 1993
--- Doc/lFndFlagNode.3 Thu May 27 12:01:53 1993
***************
*** 5,11 ****
lFndFlagNode - Get node by flag.
.SH SYNOPSIS
int
! .BR "lFndFlagNode" "(id, from, flag, data, size)"
.br
.RT
.RP
--- 5,11 ----
lFndFlagNode - Get node by flag.
.SH SYNOPSIS
int
! .BR "lFndFlagNode" "(id, which, flag, data, size)"
.br
.RT
.RP
***************
*** 12,18 ****
In int id identifier of linked list
.br
.RP
! In int from from where must be searched
.br
.RP
In int flag flag of node which must be retrieved
--- 12,18 ----
In int id identifier of linked list
.br
.RP
! In int which from which node must be searched and in which direction
.br
.RP
In int flag flag of node which must be retrieved
***************
*** 25,47 ****
.DT
.SH DESCRIPTION
\fBlFndFlagNode\fP searches a 'flagged' node from the linked list. From
! where the node must be searched can be specified by \fIfrom\fP. A node
! can be searched forward from the beginning of the list or from the
! current node and backward from the current node or from the end of the
! list.
.br
Backward searching is only possible for doubly linked list.
.br
When the found node is the first or the last node, the return code will
have the value lFIRST or lLAST, otherwise lFOUND.
.SH PARAMETER DEFINITIONS
.if t .ta 0.2i 1.5i
! \fIfrom\fP :
.nf
! lFIRST search forward from first node
! lPREVIOUS search backward from previous node
! lNEXT search forward from next node
! lLAST search backward from last node
.fi
.SH RETURN CODES
.nf
--- 25,51 ----
.DT
.SH DESCRIPTION
\fBlFndFlagNode\fP searches a 'flagged' node from the linked list. From
! which node the searching must start and in which direction must be
! searched can be specified by \fIwhich\fP. A node can be searched forward
! from the beginning of the list (lFIRST) or from the current node (lNEXT)
! and backward from the end of the list (lLAST) or from the current node
! (lPREVIOUS).
.br
Backward searching is only possible for doubly linked list.
.br
When the found node is the first or the last node, the return code will
have the value lFIRST or lLAST, otherwise lFOUND.
+ When the linked list contains only one node, the return code will have
+ the value lFIRST, when searching backward, and the value lLAST, when
+ searching forward.
.SH PARAMETER DEFINITIONS
.if t .ta 0.2i 1.5i
! \fIwhich\fP :
.nf
! lFIRST search forward starting from the first node
! lNEXT search forward starting from the next node
! lLAST search backward starting from the last node
! lPREVIOUS search backward starting from the previous node
.fi
.SH RETURN CODES
.nf
***************
*** 48,54 ****
Return on success :
lFOUND, lFIRST, lLAST, lNOT_FOUND
Return on error :
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_FROM, lSIZE_NE
.fi
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
--- 52,58 ----
Return on success :
lFOUND, lFIRST, lLAST, lNOT_FOUND
Return on error :
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lSIZE_NE
.fi
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
*** ../Doc/lFndNode.3 Fri Feb 26 10:47:50 1993
--- Doc/lFndNode.3 Thu May 27 12:01:53 1993
***************
*** 5,11 ****
lFndNode - Find node.
.SH SYNOPSIS
int
! .BR "lFndNode" "(id, from, func, ptr, data, size)"
.br
.RT
.RP
--- 5,11 ----
lFndNode - Find node.
.SH SYNOPSIS
int
! .BR "lFndNode" "(id, which, func, ptr, data, size)"
.br
.RT
.RP
***************
*** 12,18 ****
In int id identifier of linked list
.br
.RP
! In int from from where must be searched
.br
.RP
In int (*func)() function for checking the data on conditions
--- 12,18 ----
In int id identifier of linked list
.br
.RP
! In int which from which node must be searched and in which direction
.br
.RP
In int (*func)() function for checking the data on conditions
***************
*** 28,55 ****
.DT
.SH DESCRIPTION
\fBlFndNode\fP searches a node from the linked list, using the user
! defined serach function \fIfunc\fP, which checks the data of a node
on conditions. This function must have two parameters, a pointer to
the data to compare with and a pointer to the data of a node. The
possible return values are lFOUND or lNOT_FOUND. See the introduction
of Generic Linked List for an example of such a search function. From
! where the node must be searched can be specified by \fIfrom\fP. A node
! can be searched forward from the beginning of the list or from the
! current node and backward from the current node or from the end of the
! list.
.br
Backward searching is only possible for doubly linked list.
.br
When the found node is the first or the last node, the return code will
have the value lFIRST or lLAST, otherwise lFOUND.
.SH PARAMETER DEFINITIONS
.if t .ta 0.2i 1.5i
! \fIfrom\fP :
.nf
! lFIRST search forward from first node
! lPREVIOUS search backward from previous node
! lNEXT search forward from next node
! lLAST search backward from last node
.fi
.SH RETURN CODES
.nf
--- 28,59 ----
.DT
.SH DESCRIPTION
\fBlFndNode\fP searches a node from the linked list, using the user
! defined search function \fIfunc\fP, which checks the data of a node
on conditions. This function must have two parameters, a pointer to
the data to compare with and a pointer to the data of a node. The
possible return values are lFOUND or lNOT_FOUND. See the introduction
of Generic Linked List for an example of such a search function. From
! which node the searching must start and in which direction must be
! searched can be specified by \fIwhich\fP. A node can be searched
! forward from the beginning of the list (lFIRST) or from the current
! node (lNEXT) and backward from the end of the list (lLAST) or from
! the current node (lPREVIOUS).
.br
Backward searching is only possible for doubly linked list.
.br
When the found node is the first or the last node, the return code will
have the value lFIRST or lLAST, otherwise lFOUND.
+ When the linked list contains only one node, the return code will have
+ the value lFIRST, when searching backward, and the value lLAST, when
+ searching forward.
.SH PARAMETER DEFINITIONS
.if t .ta 0.2i 1.5i
! \fIwhich\fP :
.nf
! lFIRST search forward starting from the first node
! lNEXT search forward starting from the next node
! lLAST search backward starting from the last node
! lPREVIOUS search backward starting from the previous node
.fi
.SH RETURN CODES
.nf
***************
*** 58,64 ****
Return on error :
.fi
.in +0.2i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_FROM, lUNKNOWN_FUNC, lNOT_DOUBLY
! .in 10.2i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
--- 62,68 ----
Return on error :
.fi
.in +0.2i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lNOT_DOUBLY, lUNKNOWN_FUNC
! .in -0.2i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
*** ../Doc/lGetNode.3 Fri Feb 26 10:43:42 1993
--- Doc/lGetNode.3 Thu May 27 12:01:53 1993
***************
*** 29,34 ****
--- 29,37 ----
When the retrieved node is the first or the last node, the return code
will have the value lFIRST or lLAST. For the other nodes the routine
returns lSUCCESS.
+ When the linked list contains only one node, the return code will have
+ the value lFIRST, when retrieving backward, and the value lLAST, when
+ retrieving forward.
.SH PARAMETER DEFINITIONS
.if t .ta 0.2i 1.5i
\fIwhich\fP :
***************
*** 45,52 ****
lSUCCESS, lFIRST, lLAST
Return on error :
.fi
! .in +02.i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY, lSIZE_NE
! .in -02.i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
--- 48,55 ----
lSUCCESS, lFIRST, lLAST
Return on error :
.fi
! .in +0.2i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lSIZE_NE, lNOT_DOUBLY
! .in -0.2i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
*** ../Doc/lInfoNode.3 Fri Feb 26 10:44:07 1993
--- Doc/lInfoNode.3 Thu May 27 12:01:53 1993
***************
*** 44,50 ****
Return on error :
.fi
.in +0.2i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY
.in -0.2i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
--- 44,50 ----
Return on error :
.fi
.in +0.2i
! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lNOT_DOUBLY, lEOL
.in -0.2i
.SH AUTHOR
Anita Eijs (TNO - Bouw - BouwInformatica)
*** ../Doc/lSort.3 Mon Apr 19 13:49:00 1993
--- Doc/lSort.3 Thu May 27 12:01:53 1993
***************
*** 15,21 ****
.RP
In int theory sorting theory
.RP
! In int (*func)() function for comparing the data of 2 nodes
.DT
.SH DESCRIPTION
\fBlSort\fP sorts a linked list in the specified \fIorder\fP, using
--- 15,21 ----
.RP
In int theory sorting theory
.RP
! In int (*func)() function for comparing the data of two nodes
.DT
.SH DESCRIPTION
\fBlSort\fP sorts a linked list in the specified \fIorder\fP, using
***************
*** 31,43 ****
lASCENDING 'a', 'b', 'c', ...
lDESCENDING 'z', 'y', 'x', ...
.fi
\fItheory\fP :
.nf
! lBUBBLE bubble sorting algorithm ...
! lHEAP heap sorting algorithm ...
! lINSERT insert sorting algorithm ...
! lQUICK quick sorting algorithm ...
! lSELECTION selection sorting algorithm ...
.fi
.SH RETURN CODES
.nf
--- 31,44 ----
lASCENDING 'a', 'b', 'c', ...
lDESCENDING 'z', 'y', 'x', ...
.fi
+ .sp 1
\fItheory\fP :
.nf
! lBUBBLE bubble sorting algorithm
! lHEAP heap sorting algorithm
! lINSERT insert sorting algorithm
! lQUICK quick sorting algorithm
! lSELECTION selection sorting algorithm
.fi
.SH RETURN CODES
.nf